package com.wego.controller;

import com.wego.service.GoodsService;
import com.wego.service.OrderService;
import com.wego.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @className: ManagerHomeController
 * @description: 管理主页控制器
 * @author: Li Chuanwei
 * @date: 2023/07/15 18:47
 * @Company: Copyright [日期] by [作者或个人]
 **/

@Controller
public class ManagerHomeController {
    @Autowired
    OrderService orderService;

    @Autowired
    UserService userService;

    @Autowired
    GoodsService goodsService;

    @GetMapping("/managerHome")
    public String goToHome(Model model) {
        int orderNum = orderService.selectCount(null);
        int userNum = userService.selectCount(null);
        int goodsNum = goodsService.selectCount(null);
        model.addAttribute("orderNum",String.valueOf(orderNum));
        model.addAttribute("userNum",String.valueOf(userNum));
        model.addAttribute("goodsNum",String.valueOf(goodsNum));
        return "manager/home";
    }
}
